/*
 *  (C) Copyright 2007 Insula Tecnologia da Informacao Ltda.
 * 
 *  This file is part of Jazz.
 *
 *  Jazz is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Jazz is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Jazz.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.openinsula.jazz.aop;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;
import org.openinsula.jazz.AbstractJazzSpringContextTestCase;
import org.openinsula.jazz.binding.ViewBean;
import org.springframework.beans.factory.annotation.Autowired;

public class AspectTestCase extends AbstractJazzSpringContextTestCase {

	@Autowired
	private ViewBean viewBean;

	@Autowired
	private ControllerBean controllerBean;

	@Before
	public void init() {
		viewBean.getNameField().setText("Yanaga");
		viewBean.getNameLabel().setText("Name");
		controllerBean.setName("");
		controllerBean.setDescription("");
	}

	@Test
	public void testAutoProxy() {
		assertEquals("", controllerBean.getName());
		assertEquals("", controllerBean.getDescription());
		controllerBean.execute("");
		assertEquals("Yanaga", controllerBean.getName());
		assertEquals("Name", controllerBean.getDescription());
	}
}
